import getState from "@/api/state";
import HorizontalBarChart from "@/template/HorizontalBarChart/HorizontalBarChart";
import React from "react";
import { useEffect } from "react";
import { useState } from "react";

const ClmModule3 = ({ condition }) => {
    const [message, setMessage] = useState("");
    const [loading, setLoading] = useState(true);
    const [state, setState] = useState({
        data: []
    })


    useEffect(() => {
        getState({
            moduleName: "claimAmount",
            state,
            apiUrl: "/cifgp-core-api/claim/monthAndYear",
            condition: { ...condition, cType: "clmriskNumPercent" },
            setState,
            setLoading,
            setMessage,
        })
    }, [condition])


    return (
        <>
            <HorizontalBarChart
                message={message}
                loading={loading}
                style={{ width: "20%" }}
                sort={"up"}
                heightAuto
                hideBtn
                title="各险种理赔情况"
                unit="万元"
                data={[
                    state
                ]}
                toFixed={true}
                fieldNames={{
                    name:"赔付金额",
                    value:"万元"
                }}
            />
        </>
    )
}
export default ClmModule3;